package com.credit.jumu.playcard.utils;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.credit.jumu.playcard.R;

/**
 * Created by Administrator on 2017/10/23/023.
 */

public class GlideUtil {
	public static void loadImage(Context context, String imageurl, ImageView imageView) {
		if (imageView == null) return;
		Glide.with(context)
				.load(imageurl)
				.centerCrop()
				.placeholder(R.mipmap.myicon)
				.error(R.mipmap.myicon)
				.into(imageView);
	}

	//不用缓存
	public static void loadNotMemoryImage(Context context, String imageurl, ImageView imageView) {
		if (imageView == null) return;
		Glide.with(context)
				.load(imageurl)
				.centerCrop()
				.placeholder(R.mipmap.myicon)
				.error(R.mipmap.myicon)
				.skipMemoryCache(true)
				.diskCacheStrategy(DiskCacheStrategy.NONE)
				.into(imageView);
	}
	//拉伸
	public static void loadImageFitXY(Context context, String imageurl, ImageView imageView) {
		if (imageView == null) return;
		Glide.with(context)
				.load(imageurl)
				.centerCrop()
				.placeholder(R.mipmap.myicon)
				.error(R.mipmap.myicon)
				.fitCenter()
				.into(imageView);
	}
}
